import  re

#预编译正则
obj=re.compile(r"\d+")

# 返回为list
list=re.findall(r"\d+","iphone1:10086,iphone2:10087")

#iterator 迭代器  返回为迭代器
it=re.finditer(r"\d+","iphone1:10086,iphone2:10087")

#全文匹配 找到一个匹配正则的就返回  迭代器
it2=re.search(r"\d+","iphone1:10086,iphone2:10087")

#单个匹配  从头开始匹配，匹配到正则就返回 迭代器
it3=re.match(r"\d+","iphone1:10086,iphone2:10087")


##FigureModel 人物模型

text="""
<div class='zhangtie'><span id='1'>张铁</span></div>
<div class='liuguifang'><span id='2'>刘桂芳</span></div>
<div class='erzhuzi'><span id='3'>二柱子</span></div>
<div class='Uchiha Marada'><span id='4'>宇智波斑</span></div>
"""

FigureModel=re.compile(r"<div class='(?P<EnglishName>[a-zA-Z]{1,})'><span id='(?P<ID>\d+?)'>(?P<ChinaName>[\u4e00-\u9fa5]*?)</span></div>",re.S)
iter=FigureModel.finditer(text)
for i in iter:
    print(i.group("EnglishName"))
    print(i.group("ID"))
    print(i.group("ChinaName"))